
#include "hd44780_charset.h"

void init_hd44780A00_charmap(void)
{

  int c;
  unsigned char ch;

  /* Undefined characters shown as a solid block*/
  for(c=0; c<=255; c++) {
    charmap[c]=0xff;
  }

  /* Most characters <128 map to themselves*/
  for(ch =' '; ch<='}'; ch++) {
    if (ch!='\\') {
      charmap[ch]=ch;
    }
  }
  
  /* These extra characters exist in the A00 ROM at different
     locations to their latin1 codes:*/
  charmap[165]=0x5c;  /*  Yen */
  charmap[228]=0xe1;  /*  Small a-umlaut*/
  charmap[223]=0xe2;  /*  German sz-ligature (like beta)*/
  charmap[181]=0xe4;  /*  Greek mu (micro sign)*/
  charmap[162]=0xec;  /*  Cent sign*/
  charmap[163]=0xed;  /*  Pound (sterling) sign (approximately)*/
  charmap[241]=0xee;  /*  Small n-tilde*/
  charmap[246]=0xef;  /*  Small o-umlaut*/
  charmap[220]=0xf5;  /*  Large U-umlaut*/
  charmap[247]=0xfd;  /*  Divide sign*/

  /* The ROM also has symbols for a few more symbols that aren't in
  // latin1:
  // 0x7e: Right arrow
  // 0x7f: Left arrow
  // 0xe0: Lower case alpha
  // 0xe3: Lower case epsillon?
  // 0xe5: Lower case sigma?
  // 0xe6: Lower case rho?
  // 0xe8: Square root
  // 0xe9: Reciprocal (^-1)
  // 0xeb: Superscript asterisk
  // 0xf2: Upper case theta
  // 0xf3: Infinity
  // 0xf4: Upper case omega
  // 0xf6: Upper case sigma
  // 0xf7: Lower case pi
  // 0xf8: Lower case x with bar above
  // It also has a set of Japanese characters that aren't in latin1.
  
  // There are special versions of these characters with descenders,
  // but they are only useful if the display has 10 rows per character
  // rather than 8.
  //charmap['g']=0xe7;
  //charmap['j']=0xea;
  //charmap['p']=0xf0;
  //charmap['q']=0xf1;
  //charmap['y']=0xf9;

  // Use user-defined characters to get better versions of these
  // characters with descenders (the default versions don't use the
  // bottom line of the cell, which is available on an 8-row display
  // though it is shared with the cursor), and ~ and \ which are not
  // included.*/
  charmap['f']=0x00;
  charmap['g']=0x01;
  charmap['j']=0x02;
  charmap['p']=0x03;
  charmap['q']=0x04;
  charmap['y']=0x05;
  charmap['~']=0x06;
  charmap['\\']=0x07;

}


unsigned char latin1_to_hd44780A00(char c)
{
  return charmap[(unsigned char)c];
}


